<template>
  <a-config-provider :locale="locale">
    <router-view/>
  </a-config-provider>
</template>

<script>
import zhCN from 'ant-design-vue/es/locale/zh_CN';
import enUS from 'ant-design-vue/es/locale/en_US';
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
import 'dayjs/locale/es-us';
import $store from '@/common/store/_store'

export default {
  data() {
    return {
      locale: zhCN,
    };
  },
  mounted() {

    // languageKey: ['cn','bs','us','zs'],
    this.$watch(() => $store.state.languageKey, () => {
      let key = $store.state.languageKey[0]
      if (key == 'cn') {
        this.locale = zhCN
        dayjs.locale('zh-cn');
        ////console.log("切换中文")
      }
      if (key == 'bs') {
        ////console.log("切换文言文")
      }
      if (key == 'us') {
        this.locale = enUS
        dayjs.locale('es-us');
        ////console.log("切换英文")
      }
      if (key == 'zs') {
        ////console.log("切换鸟语")
      }
    })

  }
};
</script>
<style>
</style>
